<div class="table-responsive">

  <div class="filter-bar">

		<div class="view">
			<div class="row clearfix">
				<div class="col-md-3 column ui-sortable">
				    <label class="col-sm-5 control-label">选择导出类型：</label>
				    <div class="col-sm-6">
				   <select class="form-control" id="is_error" name="is_error">{$exportOptions}</select>
				    </div>
				</div>
				<div class="col-md-3 column ui-sortable">
				    <div class="col-sm-9">
				    <input id="btnExportExcel" data-url="{:U('MicroSeckillApply/exportXLS')}" type="button" class="btn btn-info" value="导出Excel"/>
				    </div>
				</div>
			</div>
		</div>

  </div>
  <hr/>



<table class="table table-hover">
  <thead>
    <tr>
      <th>ID</th>
      <th>所属微秒杀</th>
      <th>姓名</th>
      <th>联系方式</th>
      <th>地址</th>
      <th>申请时间</th>
      <th>是否成功</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    <foreach name="microSeckillApply" item="vo">
    <tr> 
      <td>{$vo.id}</td>
      <td>{$vo.microSeckillName}</td>
      <td>{$vo.name}</td>
      <td>{$vo.tel}</td>
      <td>{$vo.address}</td>
      <td>{$vo.apply_time|date='Y-m-d H:i:s',###}</td>
      <td>{$vo["is_error"]?"抢购未成功":"抢购成功"}</td>
      <td>
        <select class="audit" data-id="{$vo.id}">{$vo.statusOptions}</select>
        <input type="hidden" id="micro_seckill_id" value="{$vo.micro_seckill_id}"/>
        <a class="btn btn-danger btn-xs actionds" data-action-id="{$vo.id}" data-action-txt="移除中……" data-action-url="__CONTROLLER__/remove">移除</a>
        
      </td>
    </tr>
    </foreach>
  </tbody>
</table>
<div class="pagination">{$pagination}</div>

<script type="text/javascript">
  $(function(){
	  $("#btnExportExcel").click(function() {
		 window.location.href = $(this).attr('data-url')+"?is_error="+$("#is_error").val()+"&"+"id="+$("#micro_seckill_id").val();
		  });
	  
	  
    $( ".table" ).delegate( ".audit", "change", function(){
      var status = $( this ).val(),
          id = $( this ).attr( "data-id" );
      $.post ( "__CONTROLLER__/setStatus", { "id": id, "status": status}, function(data){
        if( data.error ) {
          $().alertMsg( { "type": "error", "msg": data.msg } );
        } else {
          $().alertMsg( { "type": "success", "msg": data.msg } );
        };
      });
    });
  });
</script>